import request from '@/utils/request';

// 获取所有评论列表（分页）
export function getCommentList(params: { pageNum: number; pageSize: number; status?: number }) {
  return request({
    url: '/api/admin/comments',
    method: 'get',
    params
  });
}

// 获取文章的评论列表
export function getArticleComments(articleId: number) {
  return request({
    url: `/api/comments/article/${articleId}`,
    method: 'get'
  });
}

// 审核评论
export function reviewComment(commentId: number, status: number) {
  return request({
    url: `/api/admin/comments/${commentId}/review`,
    method: 'put',
    data: { status }
  });
}

// 删除评论
export function deleteComment(commentId: number) {
  return request({
    url: `/api/comments/${commentId}`,
    method: 'delete'
  });
}

// 回复评论
export function replyComment(data: {
  articleId: number;
  content: string;
  parentId: number;
  replyToUserId: number;
}) {
  return request({
    url: '/api/comments',
    method: 'post',
    data
  });
} 